package com.huangsm.book.designmodel;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;

/**
 * JDK的动态代理
 * @author huang
 * @PACKAGE_NAME com.huangsm.book.designmodel
 * @PROJECT_NAME concurrence
 * @date 2019/2/15
 */
public class JdkDbQueryHandler implements InvocationHandler {
    IDKQuery real=null;
    @Override
    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
        if (real==null){
            real=new DBQuery();
        }
        return real.request();
    }
}
